<%@ include file="/WEB-INF/views/public/include.jsp"%>
<!DOCTYPE html>
<html>
<head>
	<!-- 页面编码 -->
	<meta charset="utf-8">
	<!-- 设置IE内核优先为Edge -->
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<!-- 设置360浏览器渲染引擎为webkit -->
  	<meta name="renderer" content="webkit">
	<title>约见管理中心</title>
	<link rel="stylesheet" href="/resources/admin/static/css/bootstrap.css">
	<link rel="stylesheet" href="/resources/admin/static/css/public.css">
	<!-- 基本脚本载入 -->
	<script src="//cdn.bootcss.com/jquery/2.1.4/jquery.min.js"></script>
	<script src="/resources/admin/static/js/bootstrap.min.js"></script>
</head>
<body>
	<header class="navbar navbar-default">
		<div class="container">
			<div class="navbar-header">
				<a href="/" class="navbar-brand">约见管理中心</a>
			</div>
			<!-- END .navbar-header -->
			<div class="navbar-collapse collapse">
				<ul class="nav navbar-nav navbar-right">
					<li><a href="#">大番茄</a></li>
				</ul>
				<!-- END .nav -->
			</div>
			<!-- END .navbar-collapse -->
		</div>
		<!-- END .container -->
	</header>
	<!-- END .navbar -->
	<div id="content" class="site-content">
		<div class="container">
			<div class="row">
				<div class="col-lg-2 col-md-2 col-sm-2">
					<%@ include file="/WEB-INF/views/admin/public/menu.jsp"%>
					<!-- END .list-group -->
				</div>
				<!-- END .col-md-3 -->
				<div class="col-lg-10 col-md-10 col-sm-10">
					<table class="table table-bordered table-hover">
						<thead>
							<tr>
								<th>订单号</th>
								<th>约见话题</th>
								<th>申请人</th>
								<th>价格</th>
								<th>提交时间</th>
								<th>状态</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
							<c:forEach var="application" items="${applications}">
								<tr>
									<th>#${application.id}</th>
									<td><code>${application.starName}</code> - <a href="#">${application.subjectTitle}</a></td>
									<td>${application.user.getName()}</td>
									<td><code>${application.price} 元</code></td>
									<td><fmt:formatDate value="${application.postAt}" type="both"></fmt:formatDate></td>
									<td>
										<c:choose>
											<c:when test="${application.status == 0}">
												<span class="label label-default">未支付</span>
											</c:when>
											<c:when test="${application.status == 1}">
												<span class="label label-success">已支付</span>|<span class="label label-default">未处理</span>
											</c:when>
											<c:when test="${application.status == 2}">
												<span class="label label-success">已支付</span>|<span class="label label-success">已通过</span>|<span class="label label-danger">待评价</span>
											</c:when>
											<c:when test="${application.status == 3}">
												<span class="label label-success">已支付</span>|<span class="label label-success">已通过</span>|<span class="label label-success">已评价</span>
											</c:when>
											<c:when test="${application.status == 4}">
												<span class="label label-success">已支付</span>|<span class="label label-success">已通过</span>|<span class="label label-success">已收款</span>
											</c:when>
											<c:when test="${application.status == -1}">
												<span class="label label-success">已支付</span>|<span class="label label-danger">已拒绝</span>|<span class="label label-danger">待退款</span>
											</c:when>
											<c:when test="${application.status == -2}">
												<span class="label label-success">已支付</span>|<span class="label label-danger">已拒绝</span>|<span class="label label-success">已退款</span>
											</c:when>
											<c:otherwise></c:otherwise>
										</c:choose>
									<td>
										<a href="./edit?applicationId=${application.id}" class="btn btn-primary">详情</a>
										<c:if test="${application.status == 3}">
											<a href="#" class="btn btn-danger" disabled>付款</a>
										</c:if>
										<c:if test="${application.status == -1}">
											<a href="#" class="btn btn-danger" disabled>退款</a>
										</c:if>
									</td>
								</tr>
							</c:forEach>
						</tbody>
					</table>
					<!-- END .table -->
					<nav>
						<div class="pagination">
							<c:choose>
								<c:when test="${ currentPage == 1}">
									<li class="disabled"><a href="?page=${currentPage-1 }">&laquo;</a></li>
								</c:when>
								<c:otherwise>
									<li><a href="?page=${currentPage-1 }">&laquo;</a></li>
								</c:otherwise>
							</c:choose>
							<c:forEach var="p" begin="1" end="${totalPage}">
								<c:choose>
									<c:when test="${ p == currentPage }">
										<li class="active"><a href="?page=${p}">${p}</a></li>
									</c:when>
									<c:otherwise>
										<li><a href="?page=${p}">${p}</a></li>
									</c:otherwise>
								</c:choose>
							</c:forEach>
							<c:choose>
								<c:when test="${ currentPage == totalPage}">
									<li class="disabled"><a href="?page=${currentPage+1 }">&raquo;</a></li>
								</c:when>
								<c:otherwise>
									<li><a href="?page=${currentPage+1 }">&raquo;</a></li>
								</c:otherwise>
							</c:choose>
						</div>
					</nav>
				</div>
				<!-- END .col-md-9 -->
			</div>
			<!-- END .row -->
		</div>
		<!-- END .container -->
	</div>
	<!-- END #content -->
	<script src="/resources/admin/static/js/main.js"></script>
</body>
</html>